<?php


	function lib_tools_show_captcha(){
		

		require_once($_SERVER['DOCUMENT_ROOT'].'/lib/lib_tools.php');
		
		
		require_once($_SERVER['DOCUMENT_ROOT'].'/lib/cls_gd2.php');
		
		
		$img=new cls_GD2(35,18,true);
		$bg_color=$img->buildColor__(255,255,255,0);
		$img->setBG_color($bg_color);
		
		$v_text=tools_rand_str__(4);
		
		tools_set_vision_identify_code_to_session_Str($v_text);
		tools_set_vision_identify_code_time_to_session_Str(time());
		
		$img->addText($v_text,15,0,0);
//		var_dump($img);exit;
		$img->show('png');
		
	}
	
	function lib_tools_check_email($email){
		return ereg('([a-zA-Z0-9.-_]+)@([a-zA-Z0-9-]+).([a-zA-Z]+)',$email);

	}
	
	
	function lib_get_navigat($now_page_no,$file_name,$key_name,$other=''){
		$navigat_html='';
			if ($now_page_no<6) {
				for ($i=1;$i<10;$i++){
					if ($i==$now_page_no) {
						$navigat_html .= "[{$i}] ";
					}else{
	
						$navigat_html .= "<a style='font-size:15px;' href='{$file_name}?{$key_name}={$i}{$other}'>[{$i}]</a> ";
					}
				}
	
			}else{
				for ($i=$now_page_no-4;$i<=$now_page_no+4;$i++){
					if ($i==$now_page_no) {
						$navigat_html .= "[{$i}] ";
					}else{
						$navigat_html .= "<a style='font-size:15px;' href='{$file_name}?{$key_name}={$i}{$other}'>[{$i}]</a> ";
					}
				}
				
			}
			
			return $navigat_html;
			
	}
	
	function lib_media_BBCode2html($content){
	$mp=<<<EOF
	
	<embed width="355" height="68" border="0" align="baseline" invokeurls="0" defaultframe="datawindow" clicktoplay="0" enablecontextmenu="1" allowscan="1"
		 transparentatstart="0" animationatstart="0" autorewind="0" autostart="0" showcaptioning="0" showgotobar="0"
		 autosize="0" showstatusbar="1" showdisplay="0" showtracker="1" showaudiocontrols="1" showpositioncontrols="0" showcontrols="1" name="MediaPlayer"
		 pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&amp;sbp=mediaplayer&amp;ar=media&amp;sba=plugin&amp;"
		 type="application/x-mplayer2" src="
EOF;
	$fp=<<<EOF
	<object width="480" height="415"><param name="allowFullScreen" value="true" /><embed type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="415"  src="
EOF;
//	<embed width="300" height="200" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" name="bd_asp_t5s_mp3flash" wmode="window" quality="high" flashvars="undefined" src="
	


		$a1 = array('[m]',
					'[/m]',
					'[f]',
					'[/f]',
					);
		$a2 = array($mp,
					'"/>',
					$fp,
					'"/></object>',
					);
		return str_replace($a1,$a2,$content);
		
	}


?>